﻿using Appliaction.Dto.DB;
using Domain.Entitys.DB;
using Domain.Entitys.Inv;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain.IRepositorys.DB
{
    /// <summary>
    /// 仓库接口
    /// </summary>
    public interface DB_warehouse
    {
        /// <summary>
        /// 仓库分页查询
        /// </summary>
        /// <param name="warehouse_code">编码</param>
        /// <param name="warehouse_name">仓库名称</param>
        /// <param name="currentPage">单前页</param>
        /// <param name="pageSize">查询几条</param>
        /// <returns></returns>
        List<Warehouse> Select_fy_warehouse(string warehouse_code, string warehouse_name, int currentPage, int pageSize);

        /// <summary>
        /// 查询总条数
        /// </summary>
        /// <param name="warehouse_code"></param>
        /// <param name="warehouse_name"></param>
        /// <returns></returns>
        int Select_count_warehouse(string warehouse_code, string warehouse_name);

        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<int> warehouse_tombstone(string warehouse_code);

        /// <summary>
        /// 修改冻结状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="Warehouse_freeze"></param>
        /// <returns></returns>
        Task<int> warehouse_Frozenstate(int id, char Warehouse_freeze);

        /// <summary>
        /// 仓库编码唯一性判断
        /// </summary>
        /// <param name="warehouse_code"></param>
        /// <returns></returns>
        Task<int> Warehouse_code_judgment(string warehouse_code);

        /// <summary>
        /// 仓库名称唯一性判断
        /// </summary>
        /// <param name="warehouse_code"></param>
        /// <returns></returns>
        Task<int> Warehouse_name_judgment(string warehouse_name);

        /// <summary>
        /// 添加仓库
        /// </summary>
        /// <param name="warehouse"></param>
        /// <returns></returns>
        Task<int> Warehouse_add(Warehouse warehouse);


        /// <summary>
        /// 修改仓库
        /// </summary>
        /// <param name="warehouse"></param>
        /// <returns></returns>
        Task<int> Warehouse_update(Warehouse warehouse);

        /// <summary>
        /// 分页条件查询产品库存信息
        /// </summary>
        /// <param name="productName">产品名称/编号</param>
        /// <param name="dict_code">计量单位</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示数</param>
        /// <returns></returns>
        Task<List<inv_stock>> GetInv_StockAsync(string productName,int dict_code,int currentPage,int pageSize);

        /// <summary>
        /// 条件查询产品库存信息总数
        /// </summary>
        /// <param name="productName"></param>
        /// <param name="dict_code"></param>
        /// <returns></returns>
        Task<int> Inv_StockCountAsync(string productName, int dict_code);

        /// <summary>
        /// 根据产品编号查询产品库存信息
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        Task<inv_stock> GetInv_StockByCodeAsync(string code);

        /// <summary>
        /// 根据产品编号库位查询产品库存信息
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        Task<inv_stock> GetInv_StockByCodeLocationCodeAsync(string code,string LocationCode);


        /// <summary>
        /// 查询全部库存信息
        /// </summary>
        /// <param name="warehouse_code"></param>
        /// <returns></returns>
        List<Warehouse> WarehouseBy_Select_Async();


        /// <summary>
        /// 结构编码查询仓库信息
        /// </summary>
        /// <param name="warehouse_code"></param>
        /// <returns></returns>
        List<Warehouse> WarehouseBy_Select_Async_code(string warehouse_code);

        /// <summary>
        /// 查询全部库存信息--盘点
        /// </summary>
        /// <param name="warehouse_code"></param>
        /// <returns></returns>
        List<Warehouse> WarehouseBy_Selectpd();

        /// <summary>
        ///修改仓库容量--减少
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<int> Warehouse_update_liaison(List<Db_Weahouse_capacityUpdateDto>  db_Weahouse_CapacityUpdateDtos);

        /// <summary>
        /// 修改仓库内量--增加
        /// </summary>
        /// <param name="db_Weahouse_CapacityUpdateDtos"></param>
        /// <returns></returns>
        Task<int> Warehouse_update_liaison_newly(List<Db_Weahouse_capacityUpdateDto> db_Weahouse_CapacityUpdateDtos);

        /// <summary>
        /// 修改的时候,仓库名称唯一性判断
        /// </summary>
        /// <param name="warehouse_name"></param>
        /// <param name="warehouse_code"></param>
        /// <returns></returns>
        Task<int> Warehouse_name_UpdateJudgment(string warehouse_name, string warehouse_code);
    }
}
